<?php

class Module_InfoBase_Courts extends Module_BaseModule
{
    use Lib_BaseTraitsModule;
    private static $obj = null;
    private $model = null;

    public static $fields = [
        'GH' => [
           'htmcbh' => [
               'site' => 0,
               'mast' => 1,
               'name' => '合同编号',
           ],
            'defendant_name' => [
                'site' => 1,
                'mast' => 1,
                'name' => '客户姓名',
                'array' => 1,
            ],
            'defendant_address' => [
                'site' => 2,
                'mast' => 0,
                'name' => '被告户籍地址',
                'array' => 1,
            ],
            'card_id' => [
                'site' => 3,
                'mast' => 1,
                'name' => '被告省份证号码',
                'check' => 'checkCard',
                'array' => 1,
            ],
            'mobile' => [
                'site' => 4,
                'mast' => 1,
                'name' => '被告手机号码',
                'check' => 'checkMobile',
                'array' => 1,
            ],
            'ywlx' => [
                'site' => 13,
                'mast' => 0,
                'name' => '业务类型',
            ],
            'jkqx' => [
                'site' => 15,
                'mast' => 1,
                'name' => '借款期限',
            ],
            'jkje' => [
                'site' => 16,
                'mast' => 0,
                'name' => '借款金额',
            ],
            'fkje' => [
                'site' => 17,
                'mast' => 0,
                'name' => '放款金额',
            ],
            'kfrq' => [
                'site' => 18,
                'mast' => 0,
                'name' => '放款日期',
            ],
            'hkfs' => [
                'site' => 19,
                'mast' => 0,
                'name' => '还款方式',
            ],
            'zclxll' => [
                'site' => 20,
                'mast' => 1,
                'name' => '合同约定正常利息利率',
            ],
            'yqkxll' => [
                'site' => 21,
                'mast' => 1,
                'name' => '合同约定逾期利息利率',
            ],
            'fwfl' => [
                'site' => 22,
                'mast' => 1,
                'name' => '合同约定服务费率',
            ],
            'yqdqqxr' => [
                'site' => 23,
                'mast' => 1,
                'name' => '逾期当期起息日',
            ],
            'yqdqjxr' => [
                'site' => 24,
                'mast' => 1,
                'name' => '逾期当期结息日',
            ],
            'yqrq' => [
                'site' => 25,
                'mast' => 1,
                'name' => '欠款起算日',
            ],
            'qkqsr' => [
                'site' => 25,
                'mast' => 1,
                'name' => '欠款起算日',
            ],
            'qkzjr' => [
                'site' => 26,
                'mast' => 1,
                'name' => '欠款暂计日',
            ],
            'yhqc' => [
                'site' => 28,
                'mast' => 0,
                'name' => '已还期次',
            ],
            'yhbj' => [
                'site' => 29,
                'mast' => 0,
                'name' => '已收本金',
            ],
            'yflx' => [
                'site' => 30,
                'mast' => 0,
                'name' => '已收利息',
            ],
            'yfwyj' => [
                'site' => 33,
                'mast' => 0,
                'name' => '已收违约金',
            ],
            'yffy' => [
                'site' => 31,
                'mast' => 0,
                'name' => '已收服务费',
            ],
            'qhbj' => [
                'site' => 34,
                'mast' => 1,
                'name' => '欠款本金',
            ],
            'sqje' => [
                'site' => 35,
                'mast' => 0,
                'name' => '扣减后欠款本金',
            ],
            'qfzclx' => [
                'site' => 36,
                'mast' => 0,
                'name' => '欠款利息',
            ],
            'qfyqlx' => [
                'site' => 37,
                'mast' => 0,
                'name' => '欠款罚息',
            ],
            'qkze' => [
                'site' => 38,
                'mast' => 1,
                'name' => '欠款总额',
            ],
        ]
    ];


    /**
     * 封闭构造.
     */
    public function __construct()
    {
        $this->model = new Model_InfoBase_Courts();
    }

    /**
     * 单例获取
     * 保证一条进程只产生一个Module对象
     *
     * @return Module_InfoBase_Courts
     */
    public static function getInstance()
    {
        if (empty(self::$obj)) {
            self::$obj = new self();
        }

        return self::$obj;
    }

    /*
   **添加
   * @param $insertdata
   * @return mixed
   */
    public function insert($insertdata)
    {
        return $this->model->insert($insertdata);
    }

    /**
     * 修改数据.
     */
    public function update($update, $id)
    {
        return $this->model->update($update, $id);
    }

    /**
     * 获取原告列表.
     */
    public function getList($start = 0, $limit = 0)
    {
        return $this->model->getList($start, $limit);
    }

    /**
     * 获取原告个数.
     */
    public function getCount()
    {
        return $this->model->getCount();
    }
}
